import { createRouter, createWebHashHistory, createWebHistory } from 'vue-router'
import Layout from '@/layout/index.vue'
import { RouteRecordRaw } from "vue-router";

export const routes: Array<RouteRecordRaw> = [
  {
    path: "/",
    name: "layout",
    component: Layout,
    children: [
      {
        path: "/home",
        name: "home",
        component: import("@/views/home/index.vue"),
        meta: {
          title: "首页",
          keepAlive: false, // 路由缓存
        },
      },
      {
        path: "/chat",
        name: "chat",
        component: import("@/views/chat/index.vue"),
        meta: {
          title: "讯飞大模型",
          keepAlive: true,
        },
      }
    ],
  },
];

const router = createRouter({
  history: createWebHashHistory(),
  // history: createWebHistory(import.meta.env.BASE_URL),
  routes,
});

export default router
